package com.cheng.example.book.advise151.chap6.client83.v2;


//不用校验，已经限定了是Season枚举，所以只能是Season类的四个实例，即春夏秋冬4个枚举项
public class Client {
    public void describe(Season s) {
        switch (s) {
            case Spring:
                System.out.println("this is " + Season.Spring);
                break;
            case Summer:
                System.out.println("this is summer" + Season.Summer);
                break;
        }
    }

    //通过values方法获得所有的枚举项，然后打印出来即可。如此简单，得益于枚举内置的方法
    public void query() {
        for (Season s : Season.values()) {
            System.out.println(s);
        }
    }

    public static void main(String[] args) {
        Client client = new Client();
        client.query();

    }
}
